home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / gstypes.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  3.3 KB  |  107 lines

  1. /* Copyright (C) 1989, 1995, 1998 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: gstypes.h,v 1.2 2000/09/19 19:00:33 lpd Exp $ */
  20. /* Miscellaneous common types for Ghostscript library */
  21.  
  22. #ifndef gstypes_INCLUDED
  23. #  define gstypes_INCLUDED
  24.  
  25. /*
  26.  * Define a type used internally for unique IDs of various kinds
  27.  * (primarily, but not exclusively, character and halftone bitmaps).
  28.  * These IDs bear no relation to any other ID space; we generate them all
  29.  * ourselves.
  30.  */
  31. typedef ulong gs_id;
  32.  
  33. #define gs_no_id 0L
  34.  
  35. /*
  36.  * Define a sensible representation of a string, as opposed to
  37.  * the C char * type (which can't store arbitrary data, represent
  38.  * substrings, or perform concatenation without destroying aliases).
  39.  */
  40. #define GS_STRING_COMMON\
  41.     byte *data;\
  42.     uint size
  43. typedef struct gs_string_s {
  44.     GS_STRING_COMMON;
  45. } gs_string;
  46. #define GS_CONST_STRING_COMMON\
  47.     const byte *data;\
  48.     uint size
  49. typedef struct gs_const_string_s {
  50.     GS_CONST_STRING_COMMON;
  51. } gs_const_string;
  52.  
  53. /*
  54.  * Since strings are allocated differently from ordinary objects, define a
  55.  * structure that can reference either a string (if bytes == 0) or a byte
  56.  * object (if bytes != 0, in which case data+size point within the object).
  57.  *
  58.  * Note: for garbage collection purposes, the string_common members must
  59.  * come first.
  60.  */
  61. typedef struct gs_bytestring_s {
  62.     GS_STRING_COMMON;
  63.     byte *bytes;        /* see above */
  64. } gs_bytestring;
  65. typedef struct gs_const_bytestring_s {
  66.     GS_CONST_STRING_COMMON;
  67.     const byte *bytes;        /* see above */
  68. } gs_const_bytestring;
  69.  
  70. #define gs_bytestring_from_string(pbs, dat, siz)\
  71.   ((pbs)->data = (dat), (pbs)->size = (siz), (pbs)->bytes = 0)
  72. #define gs_bytestring_from_bytes(pbs, byts, offset, siz)\
  73.   ((pbs)->data = ((pbs)->bytes = (byts)) + (offset), (pbs)->size = (siz))
  74.  
  75. /*
  76.  * Define types for Cartesian points.
  77.  */
  78. typedef struct gs_point_s {
  79.     double x, y;
  80. } gs_point;
  81. typedef struct gs_int_point_s {
  82.     int x, y;
  83. } gs_int_point;
  84.  
  85. /*
  86.  * Define a scale for oversampling.  Clients don't actually use this,
  87.  * but this seemed like the handiest place for it.
  88.  */
  89. typedef struct gs_log2_scale_point_s {
  90.     int x, y;
  91. } gs_log2_scale_point;
  92.  
  93. /*
  94.  * Define types for rectangles in the Cartesian plane.
  95.  * Note that rectangles are half-open, i.e.: their width is
  96.  * q.x-p.x and their height is q.y-p.y; they include the points
  97.  * (x,y) such that p.x<=x<q.x and p.y<=y<q.y.
  98.  */
  99. typedef struct gs_rect_s {
  100.     gs_point p, q;        /* origin point, corner point */
  101. } gs_rect;
  102. typedef struct gs_int_rect_s {
  103.     gs_int_point p, q;
  104. } gs_int_rect;
  105.  
  106. #endif /* gstypes_INCLUDED */
  107.